package ATM;

import javax.swing.*;
import java.awt.*;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;

/**
 * 查询界面
 */
public class SearchPanel extends JPanel implements ActionListener {
    private ATM frame;
    private JLabel blanceInfoLabel = new JLabel("您的余额为：");
    private JLabel blanceLabel = new JLabel();
    private JButton backBtn = new JButton("返回");
    public SearchPanel(ATM frame){
        this.frame = frame;

        this.setLayout(null);
        this.setOpaque(false);

        blanceInfoLabel.setBounds(300,200,200,50);
        blanceInfoLabel.setFont(new Font("宋体",Font.BOLD,25));
        this.add(blanceInfoLabel);

        blanceLabel.setBounds(500,200,200,50);
        blanceLabel.setFont(new Font("黑体",Font.BOLD,50));
        blanceLabel.setForeground(Color.RED);
//        blanceLabel.setText(frame.getLoginUser().getBlance() + "");
        this.add(blanceLabel);

        backBtn.setBounds(320,300,140,50);
        backBtn.addActionListener(this);
        this.add(backBtn);

    }

    public void setBlance(double blance){
        blanceLabel.setText(blance + "");
    }
    @Override
    public void actionPerformed(ActionEvent e) {
        frame.switchPanel("menu");
    }
}
